<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
readyState

<body>
    <script defer src="test1.js">
        console.log('外部defer-js完成');
    </script>
    <img src="1.jpg" alt="">
    <script>
        document.querySelector("img").onload = function () {
            console.log('图片src加载完成img的load事件触发');
        }
        document.onreadystatechange = () => {
            console.log(`document的readyState切换为->${document.readyState}`);
        }
        window.onload = function () {
            console.log('window.onload事件触发');
        }
        document.addEventListener("DOMContentLoaded", () => {
            console.log('DOMContentLoaded事件触发');
        })
    </script>
    <h1>123</h1>
    <script>
        console.log('body底部js加载完成');
    </script>
</body>

</html>